from flask import Flask,render_template
#render_template()渲染模板

app = Flask(__name__)


@app.route("/control")
def control():
    context = {
        "age" : 15,
        'books':['红楼梦','三国演义','水浒传'],
        'person':{"name":"zhiliao","age":18}
    }
    return render_template("control.html",**context)


@app.route("/about")
def about():
    context = {
        "username":"zhiliao",
        'books':['红楼梦', '三国演义']
    }
    #",".join(books) 把列表变为字符串
    return render_template("about.html",**context)


@app.route('/')
def index():
    return render_template("index.html")


if __name__ == '__main__':
    app.run()
